﻿using System;
using Microsoft.Xna.Framework;

namespace SaveTheQueen.Actions
{
    /// <summary>
    /// Action that generate values between the input and the input + goal and input - goal.
    /// <remarks>Usefull when looping to generate an infinite simple harmonic movement.</remarks>
    /// </summary>
    public class PeriodicAction : BaseAction<float>
    {
        /// <summary>
        /// Creates a new Instance of Periodic Action.
        /// </summary>
        /// <param name="game"></param>
        public PeriodicAction(Game game)
            : base(game)
        {
            IsLopping = true;
        }

        protected override void Process(GameTime gameTime)
        {
            Actual = Input + Goal * (float)Math.Sin((elapsedTime / time) * 6.28318f);
        }
    }
}
